package com.kusiri.kframework.metadata
{
	public class KfInitialUiConfiguration
	{
		
		/**
		 * array of { uiComponent : string, uiComponentOptions : object }
		 */
		public var initialUi : Array = [];
		
		public function KfInitialUiConfiguration()
		{
		}
		
		/**
		 * 
		 */
		public function toXml() : XML
		{
			var xml : XML = <initialUi></initialUi>;
			for each ( var obj : Object in initialUi )
			{
				xml.appendChild(<component id={obj.uiComponent}/>);
			}
			return xml;
		}
		
		/**
		 * 
		 */
		public static function fromXml( xml : XML ) : KfInitialUiConfiguration
		{
			var initalUi : KfInitialUiConfiguration = new KfInitialUiConfiguration();
			
			for each ( var foo : XML in xml.component )
			{
				initalUi.initialUi.push({uiComponent : foo.@id, uiComponentOptions : null});
			}
			
			return initalUi;
		}

	}
}